import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";

import { setupLayouts } from "virtual:generated-layouts";

import generatedRoutes from "virtual:generated-pages";

let routes: Array<RouteRecordRaw> = [];
generatedRoutes.forEach((v) => {
  routes.push(v?.meta?.layout != false ? setupLayouts([v])[0] : v);
});

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

console.log("router", router.options.routes);

export default router;
